#pragma once
#include"public_struct.h"
void sum_sumNumbers(TreeNode* root, int num, int &sum) {
	if (!root)return;
	num = num * 10 + root->val;
	if (!root->left && !root->right) {
		sum += num;
	}
	else {
		if (root->left) {
			sum_sumNumbers(root->left, num, sum);
		}
		if (root->right) {
			sum_sumNumbers(root->right, num, sum);
		}
	}
}

int sumNumbers(TreeNode* root) {
	int sum = 0;
	sum_sumNumbers(root, 0, sum);
	return sum;
}